FROM python:3.8

WORKDIR /home/yczha

COPY requirements.txt requirements.txt
COPY sources.list /etc/apt/sources.list
ARG PYPI=https://pypi.mirrors.ustc.edu.cn/simple
RUN apt-get update && apt-get install -y libzbar-dev\ 
    && pip install pip setuptools --upgrade -i ${PYPI}\
    && pip install -r requirements.txt -i ${PYPI}\
    && rm requirements.txt && rm -rf /.pip
COPY app app
COPY config.py .env app_inv.py ./
COPY inv_parser inv_parser
ENV FLASK_APP app_inv.py
EXPOSE 5000

CMD exec gunicorn -w 4 -b :5000 --access-logfile - --error-logfile - app_inv:app